import axios from 'axios'

const instance = axios.create({
  baseURL: 'https://smart-shop.itheima.net/index.php?s=/api/goods.service/list&goodsId=10039',
  timeout: 1000,
  headers: { platform: 'h5' }
})

// 自定义配置
// 添加请求拦截器
instance.interceptors.request.use(function (config) {
  return config
}, function (error) {
  return Promise.reject(error)
})
// 添加响应拦截器
instance.interceptors.response.use(function (response) {
  return response.data
}, function (error) {
  return Promise.reject(error)
})
// 导出实例
export default instance
